<?php if (0 < count($records)):?>
<div class="block-nine">
        <ul class="thumbnails best-firms-outer">    
        <?php foreach($records as $record):?>
        <?php 
            $firm_lnk = Yii::app()->createUrl('/firm', array('id'=>$record->id, 'slug'=> $record->slug)); 
            $service_lnk = Yii::app()->createUrl('/rubrics', array('st_id' => $record->service_type));
            $rubric_lnk = Yii::app()->createUrl('/rubrics/single', array('st_id' => $record->service_type, 'rid' => $record->rubric_id));
            $category_lnk = Yii::app()->createUrl('/category', array('st_id' => $record->service_type,'rid'=>$record->rubric_id, 'cid'=>$record->category_id));
            
        ?>
                <li class="span4">
                    <div class="thumbnail">
                        <h2><a href="<?php echo $firm_lnk;?>"><?php echo GxHtml::encode($record->title);?></a></h2>
                    
                        <?php if ('' != $record->logo):?>
                            <p><a href="<?php echo $firm_lnk;?>">
                                <img src="<?php echo $this->getFirmImgSrc($record->logo, 'firms_img_logo');?>" alt="<?php echo GxHtml::encode($record->title);?>" width="100%">
                                </a>
                            </p>
                        <?php else: ?>
                            <p><a href="#"><img src="images/firms/320x210.gif" alt="" width="100%"></a></p>
                        <?php endif; ?>
                        <ul class="breadcrumb">
                            <li><a href="<?php echo $service_lnk;?>"><?php echo Controller::getServiceType($record->service_type);?></a> <span class="divider">/</span></li>
                            <li><a href="<?php echo $rubric_lnk;?>"><?php echo $record->rubric;?></a> <span class="divider">/</span></li>
                            <li><a href="<?php echo $category_lnk;?>"><?php echo $record->category;?></a></li>
                        </ul>                       
                    </div>
                </li>
        <?php endforeach; ?>
        <?php if (0 < $adv_left): ?>
            <?php for($i=0; $i < $adv_left; $i++): ?>
                <li class="span4">
                    <div class="thumbnail">
                        <h2><a href="#">Супер-пупер фирма</a></h2>
                        <p><a href="#"><img src="images/firms/320x210.gif" alt="" width="100%"></a></p>
                        <ul class="breadcrumb">
                            <li><a href="#">Товары</a> <span class="divider">/</span></li>
                            <li><a href="#">Авто-Мото</a> <span class="divider">/</span></li>
                            <li><a href="#">Покрышки</a></li>
                        </ul>
                    </div>
                </li>             
            <?php endfor;?>
        <?php endif;?>
        </ul>
</div>
<?php endif; ?>